type 'a tree = Empty | Node of('a * 'a tree * 'a tree);; 

class ['a] bTree  =
	object (self)
		val mutable root = Empty;
		val mutable height = 0;
		val cmp = (<)
		method insert (e:'a) =
			let rec insert n (e:'a) = match n with
				| Empty -> Node(e, Empty, Empty)
				| Node(x,l,r) -> 
					if (cmp e x) then
						Node(x,insert l e,r)
					else
						Node(x,l,insert r e) in
			root <- insert root e
		method print =
				let rec aux_print n = match n with
					| Empty -> ()
					| Node(x,left,right) ->	 
						aux_print left;
						print_int(x); print_string(" ");
						aux_print right in
				aux_print root;
				print_newline()
	end
;;

let t = new bTree
;;

t#insert(9)
;;
 
t#insert(9)
;;

t#insert(1)
;;

t#insert(3)
;;

t#insert(10)
;;

t#print
;;